<?
class NewsBO extends BusinessObject{
  var $SHOW_IN_ALL = 0;
  var $FOR_MAIN = 1;
  /* private function using in constructors*/ 
  function setAttributes(){
    $this->fields   = array(
				'id'					=>	'newsID',
				'title'				=>	'newsTitle',
				'date'				=>	'newsDate',
				'visible'				=>	'newsVisible',
				'caption_article_id'	=>	'newsCaptionArticleID',
				'article_id'			=>	'full_articleID',
				'ttl'					=>	'newsTTL');

    $a = new ArticleBO();
    $this->relations = array("{$a->tableName}" =>"{$a->tableName}.{$a->fields[id]} = {$this->tableName}.{$this->fields[caption_article_id]}");

    BusinessObject::setAttributes();
  }  
  /* constructor */
  function NewsBO(){
    /** super(tableName) */
    BusinessObject::BusinessObject("news");
    $this->setAttributes();
  }

  function get_ttl_values_as_html($selected_ttl){
    $options = "";
    $ttls = array(0 =>'display always',1 =>'one day',7 =>'one week' ,30 =>'one month(30th days)');
    foreach($ttls as $key => $val){
      $options.= "<option value='$key' ".(($selected_ttl==$key)?"selected":"").">$val</option>";
    }
    return($options);
  } 
}
?>
